package com.heyqing.ems.vo;

import com.heyqing.ems.common.MateEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * ClassName:Result
 * Package:com.heyqing.ems.vo
 * Description:
 *
 * @Date:2024/6/24
 * @Author:Heyqing
 */
@Data
@AllArgsConstructor
public class Result {

    @ApiModelProperty("返回实体")
    private Object data;

    @ApiModelProperty("状态码")
    private Mate mate;

    public static Result success(Object data, MateEnum mateEnum){
        return new Result(data, new Mate(mateEnum));
    }
    public static Result fail(Object data, MateEnum mateEnum){
        return new Result(data, new Mate(mateEnum));
    }
    public static Result success(Object data, Mate mate){
        return new Result(data,mate);
    }
    public static Result fail(Object data, Mate mate){
        return new Result(data,mate);
    }
    public static Result success(Object data){
        return new Result(data,new Mate(MateEnum.SUCCESS));
    }
    public static Result success(){
        return new Result("ok",new Mate(MateEnum.SUCCESS));
    }
    public static Result fail(Object data){
        return new Result(data,new Mate(MateEnum.FAIL));
    }
    public static Result fail(MateEnum mateEnum){
        return new Result(null,new Mate(mateEnum));
    }
    public static Result fail(){
        return new Result(null,new Mate(MateEnum.FAIL));
    }
}
